<%@ page language="java" import="java.util.*,cn.ac.cintcm.dataconverge.researcher.domain.*,com.hs.core.db.*,cn.ac.cintcm.dataconverge.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String username = (String)session.getAttribute("USERINSESSION");
Researcher researcher = (Researcher) request.getSession().getAttribute(
		Constants.USER_IN_SESSION);
boolean isAdmin = AuthCheck.isAdmin(researcher);
boolean isOrgLeader = AuthCheck.isInGroup(request,Constants.ORG_LEADER);
boolean isExpert = AuthCheck.isInGroup(request,Constants.EXPERT);
boolean isOnlyExpert = AuthCheck.isOnlyExpert(request); 

boolean isYuanZhang = AuthCheck.isInGroup(request,Constants.HEADMASTER);
//默认显示科研课题
int navId = 1;

if(isYuanZhang){
	navId = 6;
}
if(isYuanZhang && isExpert){
	navId = 6;
}
if(isExpert){
	navId = 2;
}

String navStr = "id='FirNav'";

DBOperator dbo = new DBOperator(request.getSession().getServletContext());
String sql = "SELECT TO_CHAR(COUNT(A.ID)) AS EXPERTCOUNT FROM RESMAN_SUBJECT_EXPERT A LEFT JOIN RESMAN_SUBJECT B ON A.SUBJECTID=B.ID WHERE A.AUDITSTATUS=0 AND  A.EXPERT_ID=? AND B.ISDELETE='1' ";
Researcher user = (Researcher) request.getSession().getAttribute(
				Constants.USER_IN_SESSION); 
Long userId = 0l;
if(null != user){
   userId = user.getIds();
}
String countAll = "0";
List resultList = dbo.select(sql,new Object[]{userId});
if(resultList.size()>0){
	Map m = (Map)resultList.get(0);
	if(null != m.get("EXPERTCOUNT"))
		countAll = (String)m.get("EXPERTCOUNT");
}
Long orgId = -1l;
if(null != researcher && null != researcher.getOrg()){
	orgId = researcher.getOrg().getId();
}
String messageSql = "select TO_CHAR(count(*)) as messagecount from resman_inform where (REG_DEPT="+orgId +" or REG_DEPT=-1) AND EXTEND1='1' order by REG_DATE desc";
String countAllMessage = "0";
List resultList1 = dbo.select(messageSql,null);
if(resultList1.size()>0){
	Map m1 = (Map)resultList1.get(0);
	if(null != m1.get("messagecount"))
		countAllMessage = (String)m1.get("messagecount");
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>banner</title>
		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
		<link href="<%=path %>/index/Themes/com/style.css" rel="stylesheet" type="text/css" />
		<script language="javascript" src="<%=path %>/index/Scripts/Script.js"></script>
		<script language="javascript" src="<%=path %>/js/common.js"></script>
		 
	</head>
	<body>
		<!-- *************** Banner ************************* -->
		<table cellpadding="0" cellspacing="0" width="100%">
			<tr>
				<td class="bn_l"></td>
				<td class="bn_m">&nbsp;</td>
				<td class="bn_r"></td>
			</tr>
		</table>
		<!-- *************** End Banner ********************** -->
		<!-- *************** Navigation ********************** -->
		<table cellpadding="0" cellspacing="0" width="100%" class="nav_mg">
			<tr class="nav_m">
				<td class="nav_l">
						<!-- Banner Toolbar -->
					<table cellpadding="0" cellspacing="0" class="bn_tb_mg" border=0>
						<tr class="bn_tb_m">
							<td class="bn_tb_l" nowrap>欢迎：</td>
							<td class="bn_tb_i" nowrap>
							<span id="username"><font color="red"><%=username %></font></span></td>
							<td class="bn_tb_f" nowrap>
							|<a href="javaScript:openwindow('<%=path %>/index/modifyPassWord.jsp?userId=<%=researcher.getIds() %>','330','170','')" style="color:#000000">修改密码</a>&nbsp;
							|<a href="javaScript:openwindow('<%=path %>/researcher.htm?action=viewPersonInfo&userId=<%=researcher.getIds() %>','800','600','')" style="color:#000000">个人信息</a>&nbsp;
							|<a href="<%=path %>/login.htm?action=logout" style="color:#000000">退出</a></td>
							<td class="bn_tb_r">&nbsp;</td>
						</tr>
					</table>
					<!-- End Banner Toolbar -->

				</td>
				<td style="width:50px;">&nbsp;
				</td>
				<%if(!isOnlyExpert){ %>
			   <td <%if(1==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'bgmanage','','','menu_one.jsp')" id='FirNav'>科研课题</td>
			<%}else{ %>
			   <td <%if(1==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %>  id='FirNav'>科研课题</td>
			<%} %>
			<%if(isExpert || isAdmin){ %>
			<td id="nav2" <%if(2==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'review','','','menu_two.jsp')" >专家评审</td>	
			<%}else{ %>
			<td id="nav2" <%if(2==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> >专家评审</td>	
			<%} %>
			<%if(!isOnlyExpert){ %>
			<td <%if(3==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'ktmanage','','','menu_three.jsp')" >中期管理</td>
			<%}else{ %>
			<td <%if(3==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> >中期管理</td>
			<%} %>	
			<%if(!isOnlyExpert){ %>
			 <td <%if(4==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'usermanage','','','menu_four.jsp')" >成果采集</td>
			 <%}else{ %>
			 <td <%if(4==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> >成果采集</td>
			 <%} %>	
			 <%if(!isOnlyExpert){ %>
			<td <%if(5==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'jfmanage','','','menu_five.jsp')" >经费管理</td>
			<%}else{ %>
			<td <%if(5==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> >经费管理</td>
			<%} %>	 
			 <%if(!isOnlyExpert){ %>
			<td id="nav6" <%if(6==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'damanage','','','menu_six.jsp')" >统计分析</td>	
			<%}else{ %>
			<td id="nav6" <%if(6==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> >统计分析</td>
			<%} %>
			<%if(isAdmin||isOrgLeader){ %>
				<td <%if(7==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> onclick="ChangeNav(this,'system','','','menu_seven.jsp')" >系统管理</td>	
				<%}else{ %>
				<td <%if(7==navId){out.print("class='nav_s'");}else{out.print("class='nav_f'");} %> >系统管理</td>	
				<%} %>
				<td class='nav_f' onclick="ChangeNav(this,'comment','','','menu_eight.jsp')" >留言管理</td>	
				<td class='nav_f' onclick="openwindow('<%=basePath %>help/help.html','800','600','');" >在线帮助</td>
				<td>&nbsp;</td>
				<td class="nav_r"></td>
			</tr>
		</table>
		<!-- ************* End Navigation ******************** -->
		<!-- ************* Searchbar ******************** -->
		<table cellpadding="0" cellspacing="0" width="100%" class="shb_mg">
			<tr class="shb_m">
				<td class="shb_l"></td>
				<td class="shb_i"></td>
				<td class="shb_f"></td>
				<td class="shb_r"></td>
			</tr>
		</table>
		<!-- ************* End Searchbar ******************** -->
	</body>
</html>
<script type="text/javascript">
<!--
  <%if( 2== navId){%>
      var obj = document.all('nav2');
	  ChangeNav(obj,'review','','','menu_two.jsp');
  <%}else if( 6== navId){%> 
      var obj = document.all('nav6');
	  ChangeNav(obj,'damanage','','','menu_six.jsp');
  <%}else{%>
      var obj = document.all('FirNav');
      ChangeNav(document.all('FirNav'),'bgmanage','','','menu_one.jsp');
  <%}%>
  <%if(!"0".equals(countAll)){%>
 	 window.open ('<%=path%>/index/pop.jsp?allNum=<%=countAll%>', 'popone', 'height=200, width=300, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') 
  
  <%}%>
  <%if(!"0".equals(countAllMessage)){%>
 	 window.open ('<%=path%>/index/popMessage.jsp', 'poptwo', 'height=300, width=550, top=0, left=330, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no') 
  
  <%}%>
//-->
</script>
